package rkdwogus7;

import java.util.*;

public class J07_CalendarV1Practice {

	public static void main(String[] args) {
		
		Scanner sc = null;
		sc = new Scanner(System.in);
		int year;
		
		System.out.println("알고싶은 연도를 입력해주세요~");
		year = sc.nextInt();
		
		final String TITLE = "\t\tJ a n u a r y \t" + year;
		final String HDRLINE =
				"----------------------------------------------------";
		final String HDRDAYS = "Sun\tMon\tTue\tWed\tThu\tFri\tSat";
		
		System.out.println( TITLE );
		System.out.println( HDRLINE );
		System.out.println( HDRDAYS );
		
		int skipday = 
		((((year-1)*365 + (year - 1)/4 - (year - 1)/100 + (year -1)/400)%7) + 1);
		int skipday2 = 
		((((year-1)*365 + (year - 1)/4 - (year - 1)/100 + (year -1)/400)%7) + 1);
		
		for( int i = 1; i <= 31 + skipday; ++i, --skipday2 ) {
			if (skipday2 >= 1) { 
			System.out.print( " " + "\t" );				  
			} else if (i % 7 == 0) {
				System.out.println( (i - skipday) + "" );
			} else {
				System.out.print( (i - skipday) + "\t" );
			}
		}
		
		

		
	}

}


